/* dsdd.t INTERSITE REQUEST DELETE TRIGGER                            */
/*Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                 */
/*All rights reserved worldwide.  This is an unpublished work.        */
/*V8:ConvertMode=NoConvert*/
/*********************************************************************/
/*  Program :dsdd.t                                                  */
/*  Author  :Ben Holmes                                              */
/*  Date    :01/22/96                                                */
/*  !Description : dsd_det DELETE trigger program                    */
/*          : In order to enhance this trigger to support additional */
/*          : interfaces, add a DO-END block similar to the one      */
/*          : used for the Warehousing Interface to (1) check for the*/
/*          : need to continue processing; (2) move the relevant     */
/*          : fields to an appropriate work area; and (3) call       */
/*          : one or more subprograms to continue processing.        */
/*          : This .t program should remain short, relying on        */
/*          : subprograms to perform most of the work.               */
/*********************************************************************/
/*                             MODIFY LOG                            */
/*********************************************************************/
/*Revision 8.5          Last Modified:  01/22/96 BY: BHolmes *J0FY*  */
/*Revision 8.5          Last Modified:  06/25/96 BY: BHolmes *J0M9*  */
/*Revision 8.5          Last Modified:  07/27/96 BY: fwy     *J12B*  */
/*Revision 8.5          Last Modified:  01/07/97 BY: jpm     *J1DM*  */
/*Revision 9.1          Last Modified:  08/11/00 BY: *N0KK* jyn       */
/*                                                                   */
/*                                                                   */
/*********************************************************************/

TRIGGER PROCEDURE FOR DELETE OF DSD_DET.

    {mfdeclre.i }

/*J12B  if not can-find(first whl_mstr where whl_mstr.whl_act no-lock) */
/*J12B  then leave. */

    define new shared work-table wf_old_dsd_det like dsd_det.
    define new shared variable w-recid as recid.
/*J0M9*/define new shared variable w-te_type as character.
    define variable w-file as char format "x(24)".


    /* Warehousing Interface processing */

    WI:
    do:

    /* If there is no active external warehouse that is flagged to
    receive intersite request export transactions, then do not process */
/*J12B*/    if not can-find(first whl_mstr no-lock
/*J12B*/        where whl_mstr.whl_act and whl_mstr.whl_do_req_exp)
/*J12B*/    then leave WI.

    /* If the quantity confirmed has already been received,
    then do not process */
/*J12B*/    if dsd_det.dsd_qty_rcvd ge dsd_det.dsd_qty_conf then leave WI.
/*J12B      if dsd_det.dsd_qty_ship ge dsd_det.dsd_qty_ord then leave. */
/*J12B      if dsd_det.dsd_qty_ord gt 0 then leave. */

    /* Move key dsd_det fields to work table for subsequent processing */
        assign w-recid = recid(dsd_det).
        create wf_old_dsd_det.
        if recid(wf_old_dsd_det) = -1 then .
        assign  w-te_type                    = "wi-dsd-"
        wf_old_dsd_det.dsd_site      = dsd_det.dsd_site
        wf_old_dsd_det.dsd_loc       = dsd_det.dsd_loc
        wf_old_dsd_det.dsd_nbr       = dsd_det.dsd_nbr
        wf_old_dsd_det.dsd_req_nbr   = dsd_det.dsd_req_nbr
        wf_old_dsd_det.dsd_shipsite  = dsd_det.dsd_shipsite
        wf_old_dsd_det.dsd_qty_conf  = dsd_det.dsd_qty_conf.

    /* Call subprogram to create export transactions for warehouses */
        w-file = "widsdd.p".
/*J1DM*/ /* {gprun.i ""widsdd.p""} */
/*J1DM*/    {gprunmo.i &module="WI"
                       &program="widsdd.p"}


/*J12B*/end. /* WI */
